<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
<head>
    <title></title>
    <meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
    <script type="text/javascript">
        <!--
        var ligerTable = null;
        $(function(){
            $('.select-chosen').chosen();
            ligerTable = $('#table').ligerGrid({
                width:'98%',
                enabledSort:false,
                pageSizeOptions:[5,10,20,50,100,200],
                height:'auto',
                alternatingRow:true,
                url:'${base}/${route}/vehicle/getList',
                delayLoad:false,
                columns:[
                    {display:'所属公司',name:'companyName',id:'companyName',align:'center',minWidth:100},
                    {display:'车辆所在城市',name:'address',id:'address',align:'center',minWidth:80},
                    {display:'车辆号牌',name:'vehicleNo',id:'vehicleNo',align:'center',minWidth:80},
                    {display:'车牌颜色',name:'plateColor',id:'plateColor',align:'center',minWidth:80},
                    {display:'核定载客位',name:'seats',id:'seats',align:'center',minWidth:80},
                    {display:'车辆厂牌',name:'brand',id:'brand',align:'center',minWidth:80},
                    {display:'车辆型号',name:'model',id:'model',align:'center',minWidth:80},
                    {display:'车辆类型',name:'vehicleType',id:'vehicleType',align:'center',minWidth:80},
                    {display:'车辆所有人',name:'ownerName',id:'ownerName',align:'center',minWidth:80},
                    {display:'车身颜色',name:'vehicleColor',id:'vehicleColor',align:'center',minWidth:80},
                    {display:'发动机号',name:'engineId',id:'engineId',align:'center',minWidth:80},
                    {display:'车辆VIN码',name:'vin',id:'vin',align:'center',minWidth:80},
                    {display:'车辆注册日期',name:'certifyDateA',id:'certifyDateA',align:'center',minWidth:80},
                    {display:'车辆燃料类型',name:'fuelType',id:'fuelType',align:'center',minWidth:80},
                    {display:'发动机排量',name:'engineDisplace',id:'engineDisplace',align:'center',minWidth:80},
                    {display:'车辆照片文件编号',name:'PhotoId',id:'PhotoId',align:'center',minWidth:80},
                    {display:'运输证字号',name:'certificate',id:'certificate',align:'center',minWidth:80},
                    {display:'车辆运输证发证机构',name:'transAgency',id:'transAgency',align:'center',minWidth:80},
                    {display:'车辆经营区域',name:'transArea',id:'transArea',align:'center',minWidth:80},
                    {display:'车辆运输证有效期起',name:'transDateStart',id:'transDateStart',align:'center',minWidth:80},
                    {display:'车辆运输证有效期止',name:'transDateStop',id:'transDateStop',align:'center',minWidth:80},
                    {display:'车辆初次登记日期',name:'certifyDateB',id:'certifyDateB',align:'center',minWidth:80},
                    {display:'车辆检修状态',name:'fixState',id:'fixState',align:'center',minWidth:80},
                    {display:'车辆下次年检时间',name:'nextFixDate',id:'nextFixDate',align:'center',minWidth:80},
                    {display:'车辆年度审验状态',name:'checkState',id:'checkState',align:'center',minWidth:80},
                    {display:'发票打印设备序列号',name:'feePrintId',id:'feePrintId',align:'center',minWidth:80},
                    {display:'卫星定位装置品牌',name:'gpsbrand',id:'gpsbrand',align:'center',minWidth:80},
                    {display:'卫星定位装置型号',name:'gpsmodel',id:'gpsmodel',align:'center',minWidth:80},
                    {display:'卫星定位装置IMEI号',name:'gpsimei',id:'gpsimei',align:'center',minWidth:80},
                    {display:'卫星定位装置安装日期',name:'gpsinstallDate',id:'gpsinstallDate',align:'center',minWidth:80},
                    {display:'报备日期',name:'RegisterDate',id:'RegisterDate',align:'center',minWidth:80},
                    {display:'服务类型',name:'CommercialType',id:'CommercialType',align:'center',minWidth:80},
                    {display:'运价类型编码',name:'fareType',id:'fareType',align:'center',minWidth:80},
                    {
                        display:'是否推送到运管平台',
                        name:'uploadFlag',
                        id:'uploadFlag',
                        align:'center',
                        minWidth:80,
                        render:function(row){
                            if(row.uploadFlag == 1){
                                return '已推送';
                            } else if(row.uploadFlag == 0){
                                return '未推送';
                            }
                            return '--';
                        }
                    },
                    {
                        display:'状态',
                        name:'state',
                        id:'state',
                        align:'center',
                        minWidth:80,
                        render:function(row){
                            if(row.state == 0){
                                return '有效';
                            } else if(row.state == 1){
                                return '失效';
                            }
                            return '';
                        }
                    },
                    {
                        display:'操作标识',
                        name:'flag',
                        id:'flag',
                        align:'center',
                        minWidth:80,
                        render:function(row){
                            if(row.flag == 1){
                                return '新增';
                            } else if(row.flag == 2){
                                return '更新';
                            } else if(row.flag == 3){
                                return '删除';
                            }
                            return '';
                        }
                    },
                    {display:'更新时间',name:'updateTime',id:'updateTime',align:'center',minWidth:120}
                ],
                onDblClickRow: function (data, rowindex, rowobj){
                    layer.open({
                        title:'${module}',
                        type:2,
                        maxmin:false,
                        area: ['100%', '100%'],
                        content:'${base}/${route}/vehicle/view/'+data.id
                    });
                }
            });

            function reload(){
                if(ligerTable){
                    var searchKey = $('#txtSearchKey').val();
                    var companyId = $('#companyId').val();
                    ligerTable.setParm('companyId',companyId);
                    ligerTable.setParm('searchKey',searchKey);
                    ligerTable.reload();
                }
            }
            $('#btnSearch').click(function(){
                reload();
            })
            $('#btnEdit').click(function(){
                if(ligerTable){
                    var row = ligerTable.getSelectedRow();
                    if(!row || row.helpId < 1){
                        layer.msg('请选择行')
                        return;
                    }
                    var id = row.id;
                    var url='${base}/${route}/vehicle/edit/'+id;
                    changePage(url);
                }
            });
            $('#btnRemove').click(function(){
                if(ligerTable){
                    var row = ligerTable.getSelectedRow();
                    if(!row || row.helpId < 1){
                        layer.msg('请选择行')
                        return;
                    }
                    var id = row.id;
                    layer.confirm('确定要删除吗？',function(){
                        $.ajax({
                            url:'${base}/${route}/vehicle/remove/'+id,
                            type:'POST',
                            data:{},
                            dataType:'json',
                            success:function(rst){
                                layer.alert(rst.message);
                                if(rst.status=='OK' && ligerTable != null ){
                                    ligerTable.reload();
                                }
                            }
                        });
                    });
                }
            });
        });
        //-->
    </script>
</head>
<body class="$configs["skinName"]">
		<#include "common/breadcrumb.ftl">
<div class="widget-box">
    <div class="widget-header widget-header-flat">
        <h5 class="lighter">
            <i class="fa fa-search"></i>
            ${module}查询
        </h5>
    </div>
    <div class="widget-body">
        <div class="widget-main">
            <div class="row">
                <#if user?exists && companyRole?exists && user.roleId != companyRole>
                    <div class="col-sm-3 input-group">
                        <span class="input-group-addon">所属公司</span>
                        <select id="companyId" class="width-100">
                            <option value="">全部</option>
                            <#if companyList?exists && companyList?size gt 0>
                            <#list companyList as item >
                            <option value="${item.companyId}">${item.ownerName}</option>
                            </#list>
                            </#if>
                        </select>
                    </div>
                </#if>
                <div class="col-xs-5 col-sm-5">
                    <div class="input-group">
                        <span class="input-group-addon">关键字</span>
                        <input id="txtSearchKey" type="text" class="form-control search-query" placeholder="请输入关键字搜索" />
                        <span class="input-group-btn">
									<button id="btnSearch" type="button" class="btn btn-primary btn-sm">
										查询
										<i class="fa fa-search bigger-110"></i>
									</button>
								</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="widget-box">
    <div class="widget-header">
        <h5 class="lighter">
            <i class="icon-table"></i>
        ${module}列表
        </h5>
        <!--非查询者有该操作-->
				<#if user?exists && viewerRole?exists && user.roleId != viewerRole>
				<div class="widget-toolbar">
                    <button id="btnEdit" type="button" class="btn btn-primary btn-xs">
                        <i class="fa fa-check-square-o"></i>编辑
                    </button>
                    <button id="btnRemove" type="button" class="btn btn-primary btn-xs">
                        <i class="fa fa-trash-o"></i>删除
                    </button>
                </div>
                </#if>
    </div>
    <div class="widget-body">
        <div id="table"><div>
        </div>
        </div>
        </body>
</html>